import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("charge_strategy", { schema: "frog_charge" })
export class ChargeStrategy {
  @PrimaryGeneratedColumn({ type: "int", name: "strategy_id", unsigned: true })
  strategyId: number;

  @Column("int", { name: "merchant_id", unsigned: true, default: () => "'0'" })
  merchantId: number;

  @Column("varchar", { name: "strategy_name", length: 30 })
  strategyName: string;

  @Column("tinyint", { name: "strategy_type", default: () => "'0'" })
  strategyType: number;

  @Column("decimal", {
    name: "unit_price",
    precision: 4,
    scale: 2,
    default: () => "'0.00'",
  })
  unitPrice: string;

  @Column("float", {
    name: "settle_unit",
    unsigned: true,
    precision: 12,
    default: () => "'0'",
  })
  settleUnit: number;

  @Column("smallint", {
    name: "max_power",
    unsigned: true,
    default: () => "'0'",
  })
  maxPower: number;

  @Column("smallint", {
    name: "min_power",
    unsigned: true,
    default: () => "'0'",
  })
  minPower: number;

  @Column("decimal", {
    name: "card_charge_amount",
    precision: 5,
    scale: 2,
    default: () => "'0.00'",
  })
  cardChargeAmount: string;

  @Column("varchar", { name: "remark", length: 100 })
  remark: string;

  @Column("json", { name: "rules", nullable: true })
  rules: object | null;

  @Column("json", { name: "options", nullable: true })
  options: object | null;

  @Column("int", { name: "update_time", unsigned: true, default: () => "'0'" })
  updateTime: number;

  @Column("int", { name: "create_time", unsigned: true, default: () => "'0'" })
  createTime: number;
}
